home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Applications / UIFlow 1.0.1 / UIFlow Source / VSet2.0 / Src / eghi.f < prev    next >
Encoding:
Text File  |  1992-04-20  |  1.8 KB  |  86 lines  |  [TEXT/????]

  1. c    ==================================================================    
  2. c
  3. c    EGHI.F
  4. c    HDF VSET Sample Program
  5. c
  6. c    Uses High-Level routines
  7. c    Creates a vset of 1 vgroup and 3 vdatas into the file 'eghi.hdf'.
  8. c
  9. c    Jason NG NCSA 12-MAY-91
  10. c
  11. c    ==================================================================
  12.  
  13.     program SAMPLE
  14.  
  15.     integer    Zarray(200), i, j, n
  16.     real        rarray(200)
  17.     integer    conval(3,200)
  18.     integer    tagarray(10), refarray(10)
  19.  
  20.     external DFOPEN, DFCLOSE
  21.     external VHFSD, VHFSDM, VHFMKGP
  22.  
  23.     integer    DFOPEN
  24.     integer    VHFSD, VHFSDM, VHFMKGP
  25.  
  26.     integer f
  27.     integer  vs1, vs2, vs3, vg
  28.  
  29. c    --- some defined constants. see "vg.h"
  30.  
  31.     integer INTTYPE                
  32.     parameter (INTTYPE=2)
  33.     integer REALTYPE                
  34.     parameter (REALTYPE=3)
  35.     integer    VDATATAG
  36.     parameter (VDATATAG=1962)
  37.     integer FULLACC    
  38.     parameter (FULLACC=7)
  39.  
  40. c    ------ generate data -------
  41.  
  42.     do 111 i=1,200
  43.         rarray(i) = i *1.001 + 500
  44.         zarray(i) = i
  45. 111    continue
  46.  
  47.     do 112 i=1,100
  48.         do 114 j=1,3
  49.           conval(j,i) = i *j
  50. 114    continue
  51. 112    continue
  52.  
  53. c    ------- open hdf file ------
  54.  
  55.     f = DFOPEN ('eghi.hdf', FULLACC, 0)
  56.  
  57. c    ------- store 100 floats as one field in one vdata  ------
  58.     vs1 = VHFSD (f, 'MP', rarray, 100, REALTYPE,  
  59.     1                    'melting-points-vdata', 'test')
  60.  
  61. c    ------- store 120 integers as one field in one vdata  ------
  62.     vs2 = VHFSD (f, 'AGE', zarray, 100, INTTYPE,
  63.     1                    'age-of-specimens-vdata', 'test')
  64.  
  65. c    ------- store 100*3 values as one field (of order 3) in one vdata  ------
  66.     vs3 = VHFSDM (f, 'PLIST', conval, 100, INTTYPE, 
  67.     1                    'connectivity triplets','test',3)
  68.  
  69. c ------ make a vgroup that has links to all the above vdatas ----  
  70.  
  71.     tagarray(1) = VDATATAG
  72.     refarray(1) = vs1
  73.     tagarray(2) = VDATATAG
  74.     refarray(2) = vs2
  75.     tagarray(3) = VDATATAG
  76.     refarray(3) = vs3
  77.  
  78.     vg = VHFMKGP(f,tagarray,refarray,3,
  79.     1                            'vgroup with 3 vdatas (fortran)', 'test')
  80.  
  81. c    --- all done. close the file ---
  82.     call DFCLOSE (f)
  83.  
  84.     end
  85.  
  86.